package cn.kgc.ssm.controller;

import cn.kgc.ssm.dto.RecruitPageDTO;
import cn.kgc.ssm.entity.Recruit;
import cn.kgc.ssm.response.ResponseResult;
import cn.kgc.ssm.service.RecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 课工场
 * @date 2024/11/21
 * @description  招聘英才控制层
 */
@RestController
@RequestMapping("recruit")
public class RecruitController {

    @Autowired
    private RecruitService recruitService;

    //  分页
    @GetMapping("page")
    public ResponseResult  recruitPage(RecruitPageDTO recruitDTO){

        return  recruitService.recruitPage(recruitDTO);
    }

    // 添加
    @PostMapping("add")
    public ResponseResult  addRecruit(@RequestBody Recruit recruit){
        return  recruitService.addRecruit(recruit);
    }

    // 编辑岗位状态
    @PostMapping("editStatus")
    public ResponseResult  editRecruitStatus(Integer id,Integer isDelete,Integer version){
        return  recruitService.editRecruitStatus(id,isDelete,version);
    }

    // 编辑岗位信息  edit
    @PostMapping("edit")
    public ResponseResult  editRecruit(@RequestBody Recruit recruit){
        return  recruitService.editRecruit(recruit);
    }


    // 删除岗位信息
    @PostMapping("delete")
    public ResponseResult  deleteRecruit(@RequestBody List<Integer> ids){
        return  recruitService.deleteRecruit(ids);
    }


    // 前端页面招聘信息列表
    @GetMapping("front/list")
    public ResponseResult  recruitList(Integer limit){
        return  recruitService.recruitList(limit);
    }


}
